package state

import (
	"context"
	"time"
)

// State represents an agent's state
type State struct {
	ID        string
	AgentID   string
	Type      string
	Data      map[string]interface{}
	CreatedAt time.Time
	UpdatedAt time.Time
	Version   int64
}

// Manager defines the interface for state management
type Manager interface {
	// Get retrieves a state by ID
	Get(ctx context.Context, id string) (*State, error)

	// Save saves a state
	Save(ctx context.Context, state *State) error

	// Update updates a state
	Update(ctx context.Context, state *State) error

	// Delete deletes a state
	Delete(ctx context.Context, id string) error

	// List lists states by agent ID
	List(ctx context.Context, agentID string) ([]*State, error)

	// Watch watches for state changes
	Watch(ctx context.Context, agentID string) (<-chan *State, error)
}

// Event represents a state change event
type Event struct {
	Type      string
	State     *State
	Timestamp time.Time
}

// EventType represents the type of state event
type EventType string

const (
	// EventTypeCreated represents a state creation event
	EventTypeCreated EventType = "created"
	// EventTypeUpdated represents a state update event
	EventTypeUpdated EventType = "updated"
	// EventTypeDeleted represents a state deletion event
	EventTypeDeleted EventType = "deleted"
)
